import { gql } from "@apollo/client";

export const getProducts_service = gql`
  query getProducts($page: PageInput!, $name: String) {
    getProducts(page: $page, name: $name) {
      message
      data {
        id
        name
        desc
        stock
        cover
        stock
        status
        sellNum
        limitBuyNum
        bannerUrl
        originPrice
        preferentialPrice
        orgId
        cards
      }
      page {
        pageNum
        pageSize
        total
      }
    }
  }
`;

export const commitProduct_service = gql`
  mutation commitProductInfo($params: PartialProductInput!, $id: String) {
    commitProductInfo(params: $params, id: $id) {
      message
    }
  }
`;

export const delProduct_service = gql`
  mutation deleteProduct($id: String!) {
    deleteProduct(id: $id) {
      message
    }
  }
`;

export const getProductInfo_service = gql`
  query getProductInfo($id: String!) {
    getProductInfo(id: $id) {
      data {
        id
        name
        desc
        stock
        sellNum
        limitBuyNum
        cover
        status
        bannerUrl
        originPrice
        preferentialPrice
        orgId
        cards
        type
      }
    }
  }
`;


export const getProductByOrgAndUser = gql`
    query getProductsByOrgAndUser($userId: String!,$orgId: String!) {
        getProductsByOrgAndUser(userId: $userId,orgId: $orgId) {
            data {
                cover
                name
            }
        }
    }`
